IFAMS: An Integrated Farmer Advisory and Marketplace System Using Random Forest Crop Recommendation, XGBoost Price Forecasting, and Direct Farmer-Buyer Bidding
Authors: Disha D S, Disha H Jain, Dhruhi Atykar, Parth Rawat, Vanishree
Farmers face different problems across the agricultural lifecycle: crops chosen without data driven guidance, high seed and fertilizer costs, limited access to experts, uncertain market prices, and dependence on intermediaries when selling. This paper presents IFAMS, Integrated Farmer Advisory and Marketplace System, a web platform that chains five services into a single workflow: crop recommendation, seed and fertilizer guidance, expert advisory, price prediction, and a farmer buyer bidding marketplace. A Random Forest classifier recommends crops with a confidence score, from soil nutrients, weather and location. An XGBoost regressor forecasts weekly prices and a decision layer converts the forecast into a sell or hold and best market recommendations after transport and holding costs. The system uses a three tier architecture with RESTful communication and role based access for farmers, buyers, experts and administrators. The crop model reaches 98.05% accuracy (98.21% cross validation accuracy), and the price model reaches R² = 0.9808, MAE = ?368.24, RMSE = ?720.19, and MAPE = 5.52% under a chronological train test split. Both models were trained on generated data that follows the layout of public datasets, and simple baselines score about the same, so these figures should be read with care. A working prototype with four farmers, three buyers, two agronomists, and six open listings demonstrates the end to end workflow. We also discuss the limits of the current evaluation and outline future work.
Introduction
This paper presents IFAMS (Integrated Farmer Advisory and Marketplace System), a web-based platform designed to support farmers throughout the agricultural lifecycle, from crop selection to selling harvested produce. The system integrates five major services: crop recommendation, seed and fertilizer guidance, expert crop advisory, market price prediction and an online bidding marketplace. Its main objective is to improve farming decisions, reduce input costs and help farmers obtain better selling opportunities by reducing dependence on intermediaries.
1. System Architecture and Technologies
IFAMS uses a three-tier architecture consisting of a presentation layer, business logic layer and data layer. It is developed using Python Flask, SQLite, SQLAlchemy, HTML, JavaScript and machine learning libraries. The platform provides separate dashboards for farmers, buyers, agronomists and administrators, with English and Kannada language support.
2. Major Modules
Crop Recommendation: A Random Forest model recommends suitable crops using soil nutrients (NPK), temperature, humidity, pH and rainfall. It also provides confidence scores and alternative crop suggestions.
Seed and Fertilizer Guidance: Recommends suitable seeds, fertilizers, quantities and supplier information based on crop selection and soil nutrient levels.
Crop Health Advisory: Farmers upload crop photographs and describe problems. Human agronomists examine the information and provide diagnoses and treatment suggestions.
Price Prediction: An XGBoost model forecasts agricultural prices and helps farmers decide whether to sell immediately or wait for better prices. Transport and storage costs are considered when comparing markets.
Marketplace and Bidding: Farmers list their produce, while buyers place direct bids. The system displays the highest offer, allowing farmers to select a suitable buyer without depending on intermediaries.
3. Model Performance and Results
The prototype reported the following performance:
Model / Metric
Result
Random Forest crop recommendation accuracy
98.05%
Cross-validation accuracy
98.21%
XGBoost price prediction R²
0.9808
Price prediction MAE
?368.24/quintal
Price prediction RMSE
?720.19/quintal
Price prediction MAPE
5.52%
The crop recommendation model achieved high accuracy, although simpler classifiers performed similarly or slightly better. The model's accuracy also decreased when noise was added to the input data.
For price forecasting, the persistence baseline (using the previous week's price) performed slightly better than XGBoost on R² and RMSE. Ridge regression also achieved better results on the reported error metrics. In longer-horizon tests, a substitute gradient boosting model showed lower forecasting errors than persistence.
The selling decision module reported an average 8.68% improvement in realised net selling price compared with selling immediately in its backtest. This result depends on assumed holding and transportation costs and generated price data.
4. Dataset and Testing Limitations
An important limitation is that the machine learning models were trained and evaluated using artificially generated datasets rather than actual agricultural records. The crop dataset contained 3,080 records covering 22 crops, while the price dataset contained 37,440 generated records covering 18 crops across eight Karnataka markets.
The prototype was tested using demonstration accounts involving four farmers, three buyers and two agronomists. Therefore, the reported model performance and marketplace examples demonstrate technical feasibility rather than proven real-world agricultural benefits.
Other limitations include:
Crop disease diagnosis is performed manually by agronomists, not by an AI image-recognition model.
Seed, fertilizer, supplier and support-price information requires verification from official sources.
Price forecasts and confidence intervals need validation using real market data.
The marketplace lacks integrated payments, identity verification and dispute management.
The system currently supports a limited number of crops and markets, mainly in Karnataka.
5. Future Scope
Future improvements should include training and testing with real Kaggle and AGMARKNET datasets, expanding coverage to more crops and agricultural markets, introducing AI-based crop disease detection, improving price forecasting and conducting large-scale field trials. Payment facilities, secure buyer verification and dispute-resolution mechanisms can also be added.
Conclusion
IFAMS provides an end-to-end platform that supports a farmer from crop planning to sale. It combines a Random Forest crop recommender (98.05% accuracy), seed and fertilizer guidance, expert advisory, an XGBoost price forecaster (R² = 0.9808, MAPE = 5.52%) with a market-wise sell-or-hold decision layer, and a direct bidding marketplace, all behind one dashboard. By joining advisory, machine learning, and market access, the system aims to reduce dependence on intermediaries and to support data-driven farming decisions. Field validation, regional-language access, and automated disease detection are the most important next steps.
References
[1] S. Shastri, S. Kumar, V. Mansotra, and R. Salgotra, “Advancing crop recommendation system with supervised machine learning and explainable artificial intelligence,” Sci. Rep., vol. 15, 2025, doi: 10.1038/s41598-025-07003-8.
[2] M. Baishya and L. Dutta, “Tiny ML based crop recommendation system for Precision Agriculture 5.0,” Smart Agric. Technol., 2025, Art. no. 101247.
[3] B. Dey, J. Ferdous, and R. Ahmed, “Machine learning based recommendation of agricultural and horticultural crop farming in India under the regime of NPK, soil pH and three climatic variables,” Heliyon, vol. 10, no. 3, 2024.
[4] S. Khare, “Machine learning enabled crop price prediction: A review,” Indian J. Comput. Sci., vol. 11, no. 1, pp. 31–37, 2026, doi: 10.17010/ijcs/2026/v11/i1/175963.
[5] R. J. Hyndman and A. B. Koehler, “Another look at measures of forecast accuracy,” Int. J. Forecasting, vol. 22, no. 4, pp. 679–688, 2006.
[6] IDinsight, “Making digital tools work for farmers in Africa,” scoping study funded by IDRC, Apr. 2025. [Online]. Available: https://www.idinsight.org/publication/making-digital-tools-work-for-farmers-in-africa/
[7] Pallets Projects, “Flask documentation.” [Online]. Available: https://flask.palletsprojects.com
[8] F. Pedregosa et al., “Scikit-learn: Machine learning in Python,” J. Mach. Learn. Res., vol. 12, pp. 2825–2830, 2011.
[9] A. Ingle, “Crop Recommendation Dataset,” Kaggle. [Online]. Available: https://www.kaggle.com/datasets/atharvaingle/crop-recommendation-dataset
[10] “AGMARKNET: Agricultural Marketing Information Network,” Government of India. [Online]. Available: https://agmarknet.gov.in
[11] “Open-Meteo: Free weather forecast API.” [Online]. Available: https://open-meteo.com
[12] L. Breiman, “Random forests,” Mach. Learn., vol. 45, no. 1, pp. 5–32, 2001.
[13] T. Chen and C. Guestrin, “XGBoost: A scalable tree boosting system,” in Proc. 22nd ACM SIGKDD Int. Conf. Knowl. Discovery Data Mining, 2016, pp. 785–794.
[14] C. Guo, G. Pleiss, Y. Sun, and K. Q. Weinberger, “On calibration of modern neural networks,” in Proc. 34th Int. Conf. Mach. Learn. (ICML), 2017, pp. 1321–1330.
[15] C. Strobl, A.-L. Boulesteix, A. Zeileis, and T. Hothorn, “Bias in random forest variable importance measures,” BMC Bioinformatics, vol. 8, Art. no. 25, 2007.